#pragma once

#include "AbstractLock.h"
#include <QMap>
#include <QString>

class LockManager : public QObject
{
	Q_OBJECT

public:
	static LockManager *instance();
	void initLock();
	void initCard();
		
	Json::Value DealCommand(int type,QString cmd,Json::Value &param);
	Json::Value DealCommandThread(int type,QString cmd,Json::Value &param);
	AbstractLock *GetLock(QString name);	
	int GetLockCount();

	AbstractLock *GetCard(QString name);
	int GetCardCount();

signals:
	void sigCommand(int type,QString cmd,Json::Value *param,Json::Value *ret);

protected:
	QString LockString(int lockManufactuer);
	QString CardString(int lockManufactuer);

	LockManager();
	~LockManager();

	QMap<QString,AbstractLock*> m_locks;
	QMap<QString,AbstractLock*> m_cards;
};